package com.hanoi.wiki.model.json;

import java.util.ArrayList;
import java.util.List;

import com.hanoi.wiki.model.Role;
import com.hanoi.wiki.model.User;

public class RoleJson extends BaseJsonObject{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private int id;
	private String name;
	private String description;
	private List<Integer> users;
	
	public RoleJson() {
		users = new ArrayList<Integer>();
	}
	
	public RoleJson(Role role) {
		this();
		if(role != null) {
			this.id = role.getId();
			this.name = role.getName();
			this.description = role.getDescription();
			
			for(User user : role.getUsers()) {
				if(user != null) {
					users.add(user.getId());
				}
			}
		}
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public List<Integer> getUsers() {
		return users;
	}

	public void setUsers(List<Integer> users) {
		this.users = users;
	}
	
	
}
